package com.singfan.common.db;

import com.singfan.common.SingFanException;

import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

/**
 * Integer型数据列表读取的ResultSetReader
 * Author: HanSongHe
 * Date: 15-7-17 15:52
 */
public class IntegerResultSetReader implements IResultSetReader {
    @Override
    public List<Integer> readObject(ResultSet resultSet) {
        try {
            List<Integer> result = new ArrayList<>();
            while (resultSet.next()){
                result.add(resultSet.getInt(1));
            }

            return result;
        }
        catch (Exception ex){
            throw new SingFanException(String.format("IntegerResultSetReader.readObject() error: %1s !", ex.getMessage()), ex);
        }
    }
}
